#!/usr/bin/env node

// Usage :
//
//  cat ./sample01.xml | ./xml-mirror | xmllint --format - | diff sample01.xml -
//
var buffer = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
		buffer += chunk;
});

process.stdin.on('end', function () {
		var XMLMapping = require('../lib/xml-mapping.js');
		process.stdout.write(XMLMapping.toxml(XMLMapping.tojson(buffer)));
});
